﻿using System;

namespace MvcFlow.Diagnostics
{
    public static class LogManager
    {
        private static Func<string, ILog> logFactory = name => new NullLog();

        public static Func<string,ILog> LogFactory
        {
            get { return logFactory; }
            set
            {
                if ( value == null )
                {
                    logFactory = name => new NullLog();
                }
                else
                {
                    logFactory = value;
                }
            }

        }

        public static ILog GetLog(string logName)
        {
            return logFactory(logName);
        }
    }
}